<!DOCTYPE html>

<html class="no-js">

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <title></title>
  <meta name="description" content="" />
  <meta name="viewport" content="width=device-width, initial-scale=1" />
  <script src="https://cdn.staticfile.org/axios/0.19.0-beta.1/axios.js"></script>
  <script src="https://cdn.staticfile.org/vue/2.5.17/vue.js"></script>
  <link rel="stylesheet" href="../../cdn/antd/antd.min.css" />
  <script src="https://cdn.staticfile.org/moment.js/2.24.0/moment.min.js"></script>
  <script src="../../cdn/antd/antd.min.js"></script>
  <link rel="stylesheet" href="../../../lib/index.css" />
  <script src="../../../lib/avue-antd.js"></script>
</head>

<body>
  <div id="app">
    {{data}}
    <avue-form :option="option" v-model="data" @submit="handleSubmit"></avue-form>
  </div>
</body>
<script>
  new Vue({
    el: '#app',
    data() {
      return {
        data: {
          "tree1": ["xihu"],
          "switch": true,
          "slider": 33,
          "rate": 2,
          "date": "2019-08-12",
          "time": "12:22:22",
          "tree2": "zhejiang",
          "cascader": ["zhejiang", "hangzhou", "xihu"],
          "name": 'smallwei',
          "select": 0,
          "checkbox": [0],
          "sex": 0,
          "upload": [{
            name: 'text.png',
            url: 'http://avue.91eic.com/avue%400590f84d_logo.jpg?e=1566113010&token=J_o9k9l5YS62NipOMr2nHPQTbldL7PcxvXOVhJgu:axrsPMSiMXEeltJfw2Rh6uGu0FE=',
          }]
        },
        option: {
          column: [{
            label: '姓名',
            prop: 'name',
            tip: '提示语',
            rules: [{
              required: true,
              message: "请输入姓名",

            }],
          }, {
            label: '下拉框',
            prop: 'select',
            type: 'select',
            dicData: [{
              label: '男',
              value: 0
            }, {
              label: '女',
              value: 1
            }],
            rules: [{
              required: true,
              message: "请输入下拉框",

            }],
          }, {
            label: '性别',
            prop: 'sex',
            type: 'radio',
            button: true,
            border: true,
            dicData: [{
              label: '男',
              value: 0
            }, {
              label: '女',
              value: 1
            }],
            rules: [{
              required: true,
              message: "请选择性别",

            }],
          }, {
            label: '多选',
            prop: 'checkbox',
            type: 'checkbox',
            dicData: [{
              label: '男',
              value: 0
            }, {
              label: '女',
              value: 1
            }],
            rules: [{
              required: true,
              message: "请选择多选",

            }],
          }, {
            label: '开关',
            prop: 'switch',
            type: 'switch',
            dicData: [{
              label: '男',
              value: false
            }, {
              label: '女',
              value: true
            }],
            rules: [{
              required: true,
              message: "请选择开关",

            }],
          }, {
            label: '级联选择',
            prop: 'cascader',
            type: 'cascader',
            dicData: [{
              value: 'zhejiang',
              label: 'Zhejiang',
              children: [{
                value: 'hangzhou',
                label: 'Hangzhou',
                children: [{
                  value: 'xihu',
                  label: 'West Lake',
                }],
              }],
            }, {
              value: 'jiangsu',
              label: 'Jiangsu',
              children: [{
                value: 'nanjing',
                label: 'Nanjing',
                children: [{
                  value: 'zhonghuamen',
                  label: 'Zhong Hua Men',
                }],
              }],
            }],
            rules: [{
              required: true,
              message: "请选择级联选择",

            }],
          }, {
            label: '评分',
            prop: 'rate',
            type: 'rate',
            rules: [{
              required: true,
              message: "请选择开关",

            }]
          }, {
            label: '滑块',
            prop: 'slider',
            type: 'slider',
            rules: [{
              required: true,
              message: "请选择开关",

            }]
          }, {
            label: '日期',
            prop: 'date',
            format: 'YYYY-MM-DD',
            valueFormat: 'YYYY-MM-DD',
            type: 'date'
          }, {
            label: '时间',
            prop: 'time',
            type: 'time',
            format: 'HH:mm:ss',
            valueFormat: 'HH:mm:ss',
            rules: [{
              required: true,
              message: "请选择开关",

            }]
          }, {
            label: '多型树型',
            prop: 'tree1',
            type: 'tree',
            multiple: true,
            rules: [{
              required: true,
              message: "请选择开关",

            }],
            dicData: [{
              value: 'zhejiang',
              label: 'Zhejiang',
              children: [{
                value: 'hangzhou',
                label: 'Hangzhou',
                children: [{
                  value: 'xihu',
                  label: 'West Lake',
                }],
              }],
            }, {
              value: 'jiangsu',
              label: 'Jiangsu',
              children: [{
                value: 'nanjing',
                label: 'Nanjing',
                children: [{
                  value: 'zhonghuamen',
                  label: 'Zhong Hua Men',
                }],
              }],
            }],
          }, {
            label: '单型树型',
            prop: 'tree2',
            type: 'tree',
            rules: [{
              required: true,
              message: "请选择开关",

            }],
            dicData: [{
              value: 'zhejiang',
              label: 'Zhejiang',
              children: [{
                value: 'hangzhou',
                label: 'Hangzhou',
                children: [{
                  value: 'xihu',
                  label: 'West Lake',
                }],
              }],
            }, {
              value: 'jiangsu',
              label: 'Jiangsu',
              children: [{
                value: 'nanjing',
                label: 'Nanjing',
                children: [{
                  value: 'zhonghuamen',
                  label: 'Zhong Hua Men',
                }],
              }],
            }],
          }, {
            label: '上传',
            prop: 'upload',
            type: 'upload',
            listType: 'picture-card',
            props: {
              label: 'name',
              value: 'url'
            },
            propsHttp: {
              res: 'data.0'
            },
            action: 'https://avueupload.91eic.com/upload/list'
          }]
        }
      }
    },
    methods: {
      handleSubmit(form, done) {
        this.$message.success('3s后关闭');
        setTimeout(() => {
          done()
        }, 3000)
      }
    }
  })
</script>

</html>